import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/store/list',
    method: 'get',
    params: query
  })
}

export function importExcel(data) {
  return request.post(`/store/import`, data)
}

export function setLoop(id, loop, userId) {
  return request.post(`/store/${id}/loop?loop=${loop}&userId=${userId}`)
}

export function setUserId(storeIds, userId) {
  return request.post('/store/userId', { storeIds, userId })
}

export function removeUserId(storeId) {
  return request.post('/store/removeUserId', { storeId })
}

export function queryNoUserId(storeId) {
  return request({
    url: '/store/noUserId',
    method: 'get',
    params: { storeId }
  })
}

export function addScore(storeId, score) {
  return request.post(`/store/${storeId}/score/add`, { score })
}

export function setScore(storeIds, score) {
  return request.post(`/store/score`, { storeIds, score })
}

export function editStore(data) {
  return request.post(`/store/edit`, data)
}
